function grad = gradient(func)
    vars = symvar(func);
    for i = 1:length(vars),
        grad(i,1) = diff(func, vars(i));
    end;
end

